table.RELATION_GET Function

Syntax

Link_Type as C = Relation_Get()

Description

Returns the tables relation type (Single/Many).

Discussion

The <TBL>.RELATION_GET() method is used for determining the structure of a set. It returns the type of relationship between the table referenced by <TBL> and that table's parent table. Link_Type are: "First", "Last", "Closest", "Many" and "Many, Integrity". These match the options available in the Set Editor.

Example

This session in the Interactive Window shows how a set's structure can be explored.

'open the set
t = set.open("invoice.set")

The next series of commands determine the names of all of the tables in the set, but do not give the structure.

table.current(1).name_get()-> "INVOICE_HEADER"
table.current(2).name_get()-> "CUSTOMER"
table.current(3).name_get()-> "INVOICE_ITEMS"
table.current(4).name_get()-> "PRODUCT"
table.current(5).name_get()-> "VENDOR"
table.current(6).name_get()-> <No data returned>

The next command returns a CR-LF delimited string of all child tables linked to INVOICE_HEADER.

table.current(1).child_get()->
"CUSTOMER
INVOICE_ITEMS
"

The next commands return the names of the child tables linked to INVOICE_HEADER.

table.current(1).child_get(1) -> "CUSTOMER"
table.current(1).child_get(2) -> "INVOICE_ITEMS"
table.current(1).child_get(3) -> ""

Get a pointer to the CUSTOMER table and determine the type of link between CUSTOMER table and its parent.

t2 = table.get("customer")
t2.relation_get()-> "First"

Determine the type of link between INVOICE_ITEMS and its parent.

t3 = table.get("invoice_items")
t3.relation_get()-> "Many,Integrity"

Determine the parent table for INVOICE_ITEMS.

t3.parent_get()-> "INVOICE_HEADER"

See Also